package chap10collection.test21;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zdl
 * @date 2024/12/18
 */
class MyKey{
    int keyValue;
    public MyKey(){}
    public MyKey(int value){this.keyValue = value;}
}
class MyValue{
    String value;
    public MyValue(){}
    public MyValue(String value){this.value = value;}
    public String toString(){return value;}
}
public class Demo21 {
    public static void main(String args[]){
        Map map = new HashMap();
        MyKey key1 = new MyKey(10);
        map.put(key1, new MyValue("abc"));
        map.put(new MyKey(10), new MyValue("cde"));
        System.out.println(map.get(key1)); //abc
        System.out.println(map.size()); //2
    }
}
